import pycorrector
from detect_language import *



def detect(text):
    
    lang = language_detect(text)
    
    if lang == 'zh':
        corrected_sent, detail = pycorrector.correct(text)
    if lang == 'en':
        corrected_sent, detail = pycorrector.en_correct(text)

    return corrected_sent, detail, lang



if __name__ == '__main__':
    corrected_sent, detail = pycorrector.correct('少先队员因该为老人让坐')

    sent_lst = [ 'what ',' hapenning','how', 'to ','speling','it','you ','can','go..ect']
    for i in sent_lst:
        print(i, '=>', pycorrector.en_correct(i))
    print(corrected_sent, detail)